<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('一键填单')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-profitSbOrder-fillBill">
            <input type="hidden" id="hiddenForm" name="hiddenForm">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">今日单号：</label>
                <div class="col-sm-8">
                    <select name="ordernumber" class="form-control m-b"  required>
                        <option selected="selected" value="">请选择</option>
                        <option th:each="oreder : ${lists}" th:if="${oreder.ORDERTYPE+''=='1'}" th:value="${oreder.ORDERNUMBER}" th:text="${oreder.ORDERNUMBER+'对公'}" th:title="${oreder.ORDERNUMBER+'&#10'+'代付对公'+'&#10'+'出款总商户数：'+oreder.SUMTRADE+'&#10'+'出款总笔数:'+oreder.SUMCOUNT+'&#10'+'应出款金额:'+oreder.PAY_MONEY+'&#10'}"></option>
                        <option th:each="oreder : ${lists}" th:if="${oreder.ORDERTYPE+''!='1'}" th:value="${oreder.ORDERNUMBER}" th:text="${oreder.ORDERNUMBER+'对私'}" th:title="${oreder.ORDERNUMBER+'&#10'+'代付对私'+'&#10'+'出款总商户数：'+oreder.SUMTRADE+'&#10'+'出款总笔数:'+oreder.SUMCOUNT+'&#10'+'应出款金额:'+oreder.PAY_MONEY+'&#10'}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "agentInfo/profitSbOrder"
        $("#form-profitSbOrder-fillBill").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var searchFormValue = parent.$("#formId").serialize();
                $("#hiddenForm").val(searchFormValue);
                //$.operate.save(prefix + "/fillBill", $('#form-profitSbOrder-fillBill').serialize());
                var formData = new FormData();
                formData.append("searchFormValue",searchFormValue);
                var ordernumber=$("[name='ordernumber']").val();
                formData.append("ordernumber",ordernumber);
                $.ajax({
                    url : prefix + "/fillBill",
                    type: 'POST',
                    data: formData,
                    cache: false,
                    contentType: false,
                    processData: false,
                    beforeSend: function () {
                        $.modal.loading("正在处理中，请稍后...");
                        $.modal.disable();
                    },
                    success : function(result) {
                        if (result.code == web_status.SUCCESS) {
                            var parent = window.parent;
                            if (parent.table.options.type == table_type.bootstrapTable) {
                                $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
                            } else if (parent.table.options.type == table_type.bootstrapTreeTable) {
                                $.modal.close();
                                parent.$.modal.msgSuccess(result.msg);
                                parent.$.treeTable.refresh();
                            } else {
                                $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS);
                            }
                        } else if (result.code == web_status.WARNING) {
                            $.modal.alertWarning(result.msg)
                        }  else {
                            $.modal.alertError(result.msg);
                        }
                        $.modal.closeLoading();
                        $.modal.enable();
                    },
                    error : function(result) {
                        $.modal.alertError(result.msg);
                    }
                });
            }
        }
    </script>
</body>
</html>